package cn.js.ccit.mapper;

import cn.js.ccit.vo.UserVo;
import org.apache.ibatis.annotations.One;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface UserMapper {
    @Select("select * from tb_user where userId=#{userId}")
    @Results(
            @Result(column = "departId",property = "department",
                    one = @One(select = "cn.js.ccit.mapper.DepartmentMapper.getDepartmentById"))
    )
    UserVo getUserById(Integer userId);

    @Select("select * from tb_user")
    @Results(
            @Result(column = "departId",property = "department",
                    one = @One(select = "cn.js.ccit.mapper.DepartmentMapper.getDepartmentById"))
    )
    List<UserVo> getAllUser();
}
